var child;
var isRed;
/**
 * layui主体代码
 */
layui.use(['form', 'laydate'], function () {
    var form = layui.form,
        layer = layui.layer,
        $ = layui.$,
        laydate = layui.laydate;

    /**
     * 监听提交
     */
    form.on('submit(saveBtn)', function (data) {
        child = data.field;
        var data = data.field;
        console.log(data);
        var updateid= $("#id").val();
        console.log("id" + updateid);
        console.log(data);
        $.post("_class/add",{
            classname: data.className,
            creattime: data.beginTime,
            lifeTeacherName:data.lifeTeacherName,
            semesterName: data.semesterName,
            stipulate:data.stipulate,
            teacherName: data.teacherName
        },function (result) {
            if (result.success == true){
                // parent.parentPage(result, child);
                var index = parent.layer.getFrameIndex(window.name);
                parent.layer.close(index);
            }
            // close(result);
        })

        return false;
    });
    /**
     * 时间选择框样式
     */
    laydate.render({
        elem: '#begin'
        , theme: '#393D49'
    });
});
/**
 * 子向父传值方法
 * @param result
 */
function close(result) {


}